<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<style>
    .tableShow .layui-table-body{max-height: 350px}
    .qingbgclr{background-color: #666!important;color: #FFFFFF;}
    .qingbgclr:hover{background-color: #666!important;color: #666;}
    #datalist_basal tbody tr:hover{background-color: #666!important;color: #666!important;}
</style>
<body id="xiangqingPage">
<div id="xiangqingBox" style="padding-bottom: 10px">
    <div class="page-title">
        <div class="page-title-con">
            <span>基准费用-在用明细</span>
            <div class="move_title"></div>
            <div class="page-title-opt-list">
                <span id="page-close" class="page-close" onclick="layer_close()"><i class="layui-icon layui-icon-close"></i></span>
            </div>
        </div>
    </div>
    <form class="main-container layui-form layui-form-pane">
        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">基底清单数据</script>
            <div class="tableShow" id="datalist_basal">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>
        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo_tong">组价信息</script>
            <div class="tableShow">
                <table id="datalist_tong" lay-filter="datalist_tong"></table>
            </div>
        </div>
    </div>
</div>
<script>
    var param_markid = getQueryVariable('markid') || 0;
    var param_enginid = getQueryVariable('enginid') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element, layer = layui.layer;

        facade.ajax({url: ask_main_mark_basal, data:{markid: param_markid, enginid: param_enginid}}).done(function(res){
            if (res.code === 2000) {
                var mytableList = table.render({
                    elem: "#datalist",data:res.data.basal, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: ['','',''],filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field:'encode',title:'项目编码',width:140}
                        ,{field:'enname',title:'项目名称',templet: function(d){return '<span class="enname" basalid="'+d.id+'">'+d.enname+'</span>';},width:300}
                        ,{field:'enfeat',title:'项目特征描述',width:400}
                        ,{field:'enunit',title:'计量单位',width:100}
                        ,{field:'enword',title:'工程量',width:150}
                        // ,{field:'dan_ren',title:'人工费(元)',width:150}
                        // ,{field:'dan_cai',title:'材料费(元)',width:150}
                        // ,{field:'dan_ji',title:'机械费(元)',width:150}
                        // ,{field:'dan_zhuan',title:'专业分包(元)',width:150}
                        // ,{field:'dan_zong',title:'综合成本单价(元)',width:150}
                        // ,{field:'fee_zong',title:'综合成本合计(元)',width:150}
                        // ,{field:'fee_ren',title:'人工费合计(元)',width:150}
                        // ,{field:'fee_cai',title:'材料费合计(元)',width:150}
                        // ,{field:'fee_ji',title:'机械费合计(元)',width:150}
                        // ,{field:'fee_zhuan',title:'专业分包合计(元)',width:150}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });
                render_from();
            }
        });


        $('body').on('click','#datalist_basal tbody tr',function () {
            $('#datalist_basal tbody tr').removeClass('qingbgclr');
            $(this).addClass('qingbgclr');
            var basalid = $(this).find('.enname').attr('basalid') || 0;
            get_zujiadata(basalid);
        });

        function get_zujiadata(basalid=0){
            facade.ajax({url: ask_main_mark_basal, data:{markid: param_markid, enginid: param_enginid, basalid:basalid}}).done(function(res){
                if (res.code === 2000) {
                    var data = res.data.data;

                    var tongtableList = table.render({
                        elem: "#datalist_tong",data:res.data.basallist, toolbar: '#toolbarDemo_tong', page: false
                        ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                        ,defaultToolbar: ['','',''],filter: TabInitShow.filter ,text: TabInitShow.text
                        ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                        , cols: [[
                            {type:'numbers',title:'序号',fixed:'left'}
                            ,{field:'type_name',title:'费用类型'}
                            ,{field:'basetype',title:'类别'}
                            ,{field:'name',title:'名称'}
                            ,{field:'guige',title:'特征描述'}
                            ,{field:'valunit',title:'单位'}
                            ,{field:'content_exp',title:'含量计算式'}
                            ,{field:'content',title:'含量'}
                            ,{field:'loss_rate',title:'损耗率'}
                            ,{field:'no_price',title:'不含税单价(元)'}
                            ,{field:'price',title:'成本单价(元)'}
                            ,{field:'explain',title:'备注'}
                        ]]
                        , done: function (res) {
                            soulTable.render(this);
                        }
                    });
                    render_from();
                }
            });
        }


    });


</script>
</body>
</html>




